//
//  TrainingVideoData.m
//  JiZhuiAn
//
//  Created by Easy.Lin on 16/7/10.
//  Copyright © 2016年 Easy. All rights reserved.
//

#import "TrainingVideoData.h"

@implementation TrainingVideoData

- (instancetype)initFromBmobObject:(BmobObject *)obj
{
    self = [super initFromBmobObject:obj];
    if (self) {
        BmobFile * videoFile = [obj objectForKey:@"videoFile"];
        BmobFile * imageFile = [obj objectForKey:@"imageFile"];
        NSString * descriptionString = [obj objectForKey:@"description"];
        if ([descriptionString containsString:@"/n"]) {
            descriptionString = [descriptionString stringByReplacingOccurrencesOfString:@"/n" withString:@"\n"];
        }
        self.actionDescription = descriptionString;
        self.videoURL = videoFile.url?videoFile.url:@"";
        self.imageURL = imageFile.url?imageFile.url:@"";
        self.actionName = [obj objectForKey:@"actionName"];
        self.sortTag = [[obj objectForKey:@"sortTag"] integerValue];
    }
    return self;
}

@end
